<?php

class GoodsController extends AdminController {
	public $modelName = 'Goods';
	
	public function outerActions() {
		return array_merge(parent::outerActions(), array(
			'admin' => 'actions.goods.admin',
			'edit' => 'actions.goods.edit',
			'commit' => 'actions.audit.commit',
			'passed' => 'actions.audit.passed',
			'unpassed' => 'actions.audit.unpassed',
			'listing' => 'actions.goods.listing',
			'delisting' => 'actions.goods.delisting',
		));
	}
	
	public function modelProvider() {
		if(!Yii::app()->adminUser->isGuest && Yii::app()->adminUser->role == AdminUser::ROLE_OPERATOR) return parent::modelProvider();
		$id = Yii::app()->adminUser->id;
		return array_merge(parent::modelProvider(), array(
			'criteria' => array(
				'condition' => "provider_id = '{$id}'",
			),
		));
	}
	
}

?>